home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 609 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.2 KB

  1. Path: wndrwrks.demon.co.uk!andy
  2. From: Andy Armstrong <andy@wndrwrks.demon.co.uk>
  3. Newsgroups: comp.lang.ada,comp.lang.c++,comp.lang.c,comp.lang.modula3,comp.lang.modula2,comp.edu,comp.lang.eiffel
  4. Subject: Re: Hungarian notation
  5. Date: Fri, 5 Jan 1996 10:40:25 +0000
  6. Organization: WonderWorks
  7. Distribution: world
  8. Message-ID: <HtlknJAZAQ7wEwjl@wndrwrks.demon.co.uk>
  9. References: <30C40F77.53B5@swsbbs.com> <marnoldDJEvtJ.1Lx@netcom.com>
  10.  <4aleun$jlk@ns.RezoNet.NET> <marnoldDJMDBG.CFz@netcom.com>
  11.  <4asnkr$7b0@solutions.solon.com> <4ath75$e7i@barnacle.iol.ie>
  12.  <4b4kij$svt@news.microsoft.com> <dewar.819489496@schonberg>
  13.  <4behis$3cl@dux.dundee.ac.uk> <RIGOTTI.95Dec29100514@roach.dra.hmg.gb>
  14.  <4cd8fc$oud@news.manawatu.gen.nz>
  15. NNTP-Posting-Host: wndrwrks.demon.co.uk
  16. X-NNTP-Posting-Host: wndrwrks.demon.co.uk
  17. MIME-Version: 1.0
  18. X-Newsreader: Turnpike Version 1.10 <qBJsdVzqmTD$H3HpwSrFWKs0Aw>
  19.  
  20. In article <4cd8fc$oud@news.manawatu.gen.nz>, Chris Tutty
  21. <ctutty@manawatu.gen.nz> writes
  22. >I've always disliked HN, not only because it can make the variable
  23. >names less readable, but because it violates a basic principle - that
  24. >of avoiding unnecessary redundancy.
  25. >
  26. >My opionion: HN should not be used in any typed language because it
  27. >creates an opportunity for the actual declared type of a variable
  28. >(which the machine uses) to be different from it's HN prefix (which
  29. >the programmer uses).
  30. >
  31. >This is the sort of thing that causes maintenance problems.  To find
  32. >out a variable's type you should always search for the initial
  33. >declaration.  To make a type-dependent decision on the basis of a
  34. >comment is asking for trouble.
  35.  
  36. I take this point, but think about what it says about comments, white
  37. space and indenting. In each case one trusts that the programmer has
  38. these right; there's no way the compiler will check.
  39.  
  40. Consider also that variable names may be misleading anyway. In that
  41. sense there's no great difference between
  42.  
  43.         someProc(MyString)
  44.  
  45. and
  46.  
  47.         someProc(pszMyString)
  48.  
  49. either could quite happily refer to any other data type.
  50.  
  51. Perhaps what's needed if Hungarian is adopted is optional compiler
  52. warnings to verify that HN names are actually correct?
  53.  
  54.   Andy Armstrong                  WonderWorks
  55.   Phone/fax: 01665 602868 Mobile: 0860 922719
  56.